#!/bin/sh

rm -f product.key

# 30 days from now
let date=`date +%s`
let date=$date+60*60*24*30

while true
do

	export FWPK_DATE=`date --date="@$date" "+%m/%d/%Y %H:%M:%S"`
	echo
	echo

	../src/fwpk -date "$FWPK_DATE" > product.key
	if ( test "$?" = "1" )
	then
		rm -f product.key
		exit 1
	fi

	make > /dev/null 2>&1
	if ( test "$?" = "1" )
	then
		rm -f product.key
		exit 1
	fi

	./product
	if ( test "$?" = "1" )
	then
		rm -f product.key
		exit 1
	fi

	# bump by 1 day
	let date=$date+60*60*24
done
